package com.ysq.www.api.work.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ysq.www.api.work.entity.ReplyAll;
import com.ysq.www.api.work.service.IReplyAllService;
import com.ysq.www.common.annotation.AuthToken;
import com.ysq.www.common.result.ResultMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author dql
 * @Description 待办整合类 控制器
 * @Date 2020/9/11 0011
 */
@RestController
@RequestMapping("/work/replyAll")
public class ReplyAllController {

    @Autowired
    private IReplyAllService replyAllService;

    /**
     * 查询所有我发起的待办
     * @param userId 用户id
     * @param time 日期
     * @param pageNumber 页码
     * @param pageSize 页大小
     * @return ResultMsg
     */
    @GetMapping("/myAll")
    @AuthToken
    public ResultMsg selectMyAllById(Integer userId,String time,Integer pageNumber,Integer pageSize){
        IPage<ReplyAll> rPage = replyAllService.selectMyAllById(userId,time,pageNumber,pageSize);
        return ResultMsg.SUCCESS.setNewMsg("查询成功").setNewData(rPage);
    }

    /**
     * 查询处理/待处理的待办
     * @param userId 用户id
     * @param time 日期
     * @param type 类型：0未处理，1已处理
     * @param pageNumber 页码
     * @param pageSize 页大小
     * @return ResultMsg
     */
    @GetMapping("/pending")
    @AuthToken
    public ResultMsg selectPendingByPage(Integer userId,String time,Integer type,Integer pageNumber,Integer pageSize){
        IPage<ReplyAll> rPage = replyAllService.selectPendingByPage(userId,time,type,pageNumber,pageSize);
        return ResultMsg.SUCCESS.setNewMsg("查询成功").setNewData(rPage);
    }

    /**
     * 查询抄送至我的待办
     */

}
